package site.icesky.springboot.redis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import site.icesky.springboot.redis.service.RedisService;

/**
 * @ClassName: SpringRedisController <br>
 * @Description: 测试jedis <br>
 * @Package: site.icesky.springredis.controller <br>
 * @author: suitianmou <br>
 * @Date: 2020/5/19-23:54 <br>
 * @version: 1.0 <br>
 * @see <br>
 * @since (从产品的哪一个版本此类被添加进来 ( 可选))<br>
 * 修改历史: <br>
 * 修改时间             修改人           版本变更           修改说明<br>
 * -----------------------------------------------------<br>
 * <br>
 */
@RestController
public class RedisController {

    @Autowired
    RedisService redisService;

    @RequestMapping(path="/redis")
    @ResponseBody
    public String redisSetGet(){
        String input = "redisTestKey:redisTestValue";
        String key = input.split(":", -1)[0];
        String value = input.split(":", -1)[1];

        System.out.println(key + value);
        redisService.set( key, value);
        return key + " : "  + redisService.get(key);
    }

}
